// 柯里化案例
// ''.match(/\s+/g)
// ''.match(/\d+/g)
import _ from 'lodash'


const match=_.curry(function(reg,str){
    return str.match(reg)
})

const haveSpace=match(/\s+/g)
const haveNumber=match(/\d+/g)
console.log(haveSpace('he llo world'))  // ['','']
console.log(haveNumber('abc1'))   //['1']

const filter=_.curry(function(func,arr){
    return arr.filter(func)
})

console.log(filter(haveSpace,['John Connor','John_Domne']))

const findSpace=filter(haveSpace)

console.log(findSpace(['John Connor','John_Domne']))